package com.guang.syncronized;

import com.guang.syncronized.domain.A;
import org.openjdk.jol.info.ClassLayout;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.TimeUnit;

/**
 * @Description 证明偏向锁已经偏向
 * @Author liguang
 * @Date 2022/10/19/10:36
 */
public class SyncronziedDemoFive {
    private final static Logger logger = LoggerFactory.getLogger(SyncronziedDemoFive.class);
    public static void main(String[] args) {
        try {
            TimeUnit.SECONDS.sleep(5);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        A lock  = new A();
        synchronized (lock){
            logger.info(ClassLayout.parseInstance(lock).toPrintable());
        }
    }

}
